Private Declare Function kpGetProfileInt Lib "kernel32" Alias "GetProfileIntA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Integer) As Integer
Private Declare Function kpGetProfileString Lib "kernel32" Alias "GetProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer) As Integer
Private Declare Function kpWriteProfileString Lib "kernel32" Alias "WriteProfileStringA" (ByVal lpAppName As Any, ByVal lpKeyName As Any, ByVal lpString As Any) As Integer
Private Declare Function kpGetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Integer, ByVal lpFileName As String) As Integer
Private Declare Function kpGetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
Private Declare Function kpWritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpAppName As Any, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Integer
Private Declare Function kpSendMessage Lib "User32" Alias "SendMessage" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
Private Declare Function kpGetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectory" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer
Public smSectionName As String 'Current section in private Ini file
Public smIniFileName As String 'Fully qualified path/name of current private Ini file
Public nmPrivInit As Integer 'Flag to indicate that Private.Ini is initialized
Private Const Max_SectionBuffer = 4096
Private Const Max_EntryBuffer = 255
Public Function ExtractName$(sSpecIn$, nBaseOnly%)
Dim nCnt%, nDot%, sSpecOut$
On Local Error Resume Next
If InStr(sSpecIn, "\") Then
For nCnt = Len(sSpecIn) To 1 Step -1
If Mid$(sSpecIn, nCnt, 1) = "\" Then
sSpecOut = Mid$(sSpecIn, nCnt + 1)
Exit For
End If
Next nCnt
ElseIf InStr(sSpecIn, ":") = 2 Then
sSpecOut = Mid$(sSpecIn, 3)
Else
sSpecOut = sSpecIn
End If
If nBaseOnly Then
nDot = InStr(sSpecOut, ".")
If nDot Then
sSpecOut = Left$(sSpecOut, nDot - 1)
End If
End If
ExtractName$ = UCase$(sSpecOut)
End Function
Public Function ExtractPath$(sSpecIn$)
Dim nCnt%, sSpecOut$
On Local Error Resume Next
If InStr(sSpecIn, "\") Then
For nCnt = Len(sSpecIn) To 1 Step -1
If Mid$(sSpecIn, nCnt, 1) = "\" Then
sSpecOut = Left$(sSpecIn, nCnt)
Exit For
End If
Next nCnt
ElseIf InStr(sSpecIn, ":") = 2 Then
sSpecOut = CurDir$(sSpecIn)
If Len(sSpecOut) = 0 Then sSpecOut = CurDir$
Else
sSpecOut = CurDir$
End If
If Right$(sSpecOut, 1) <> "\" Then
sSpecOut = sSpecOut + "\"
End If
ExtractPath$ = UCase$(sSpecOut)
End Function
Public Sub PrivClearEntry(sEntryName As String)
'Bail if not initialized
If Not nmPrivInit Then
PrivIniNotReg
Exit Sub
End If
'Sets a specific entry in Private.Ini to Nothing or Blank